import request from '@/utils/request'

//获取问题类型列表
export function getProblemsList(params) {
  return request({
    url: '/api/problem_type/',
    method: 'get',
    params
  })
}

//获取操作人
export function getuserList(params) {
  return request({
    url: '/api/get_report_admin/',
    method: 'get',
    params
  })
}

//登录申诉获取操作人
export function getuserList2(params) {
  return request({
    url: '/api/get_kefu_yunyin/',
    method: 'get',
    params
  })
}

//通过id获取问题类型信息
export function updateProblemById(id, data) {
  return request({
    url: `/api/problem_type/${id}/`,
    method: 'put',
    data
  })
}

//通过id修改问题类型信息
export function getProblemById(id,) {
  return request({
    url: `/api/problem_type/${id}/`,
    method: 'get'
  })
}


//获取常见问题列表
export function getCommonProblemsList(params) {
  return request({
    url: '/api/common_problem/',
    method: 'get',
    params
  })
}

//通过ID获取常用配置信息
export function getCommonProblemById(id) {
  return request({
    url: `api/common_problem/${id}/`,
    method: 'get'
  })
}

//通过ID修改常用配置
export function updateCommonProblemById(id, data) {
  return request({
    url: `api/common_problem/${id}/`,
    method: 'put',
    data
  })
}

export function addCommonProblem(data) {
  return request({
    url: '/api/common_problem/',
    method: 'POST',
    data
  })
}

//通过ID删除常用配置
export function deleteCommonProblemById(id) {
  return request({
    url: `api/common_problem/${id}/`,
    method: 'DELETE'
  })
}

//获取客服常用数据列表
export function getCommonStatement(params) {
  return request({
    url: '/api/phrase/',
    method: 'get',
    params
  })
}

//通过id获取客服常用语配置信息
export function getCommonStatementById(id) {
  return request({
    url: `/api/phrase/${id}/`,
    method: 'get'
  })
}

//通过id修改客服常用语配置
export function updateCommonStatementById(id, data) {
  return request({
    url: `/api/phrase/${id}/`,
    method: 'put',
    data
  })
}

//添加客服常用语配置
export function addCommonStatement(data) {
  return request({
    url: '/api/phrase/',
    method: 'POST',
    data
  })
}

//删除客服常用语配置
export function deleteCommonStatement(id) {
  return request({
    url:`/api/phrase/${id}/`,
    method:'DELETE'
  })
}

//获取客服公告列表
export function getBulletinList() {
  return request({
    url: '/api/announcement/',
    method: 'GET'
  })
}

//通过id获取客服公告信息
export function getBulletinById(id) {
  return request({
    url: `/api/announcement/${id}/`,
    method: 'get'
  })
}

//通过ID修改公告信息
export function updateBulletinById(id, data) {
  return request({
    url: `/api/announcement/${id}/`,
    method: 'put',
    data
  })
}

//通过ID删除公告信息
export function deleteBulletinById(id) {
  return request({
    url: `/api/announcement/${id}/`,
    method: 'DELETE'
  })
}

//添加公告信息
export function addBulletin(data) {
  return request({
    url: '/api/announcement/',
    method: 'POST',
    data
  })
}

//获取平台
export function getPlatform() {
  return request({
    url: '/admin/pro_config/',
    method: 'get'
  })
}

//获取充值申诉列表
export function getAppeal(params) {
  return request({
    url: '/api/appeal/',
    method: 'get',
    params
  })
}

//通过id获取充值申诉详情
export function getAppealById(id) {
  return request({
    url:`/api/work_order/${id}/`,
    method:'get'
  })
}

export function updateAppealById(id,data) {
  return request({
    url:`/api/work_order/${id}/`,
    method:'put',
    data
  })
}

//获取客服回单列表
export function getCustomerOrder(params) {
  return request({
    url: '/api/customer_order/',
    method: 'get',
    params
  })
}

//客服回单
export function updateCustomerOrder(id,data) {
  return request({
    url:`/api/work_order/${id}/`,
    method:'put',
    data
  })

}

//获取工单管理列表
export function getWorkOrder(params) {
  return request({
    url: '/api/work_order/',
    method: 'get',
    params
  })
}

//获取工单管理列表
export function getWorkOrderQuery(params) {
  return request({
    url: '/api/order_query/',
    method: 'get',
    params
  })
}

//工单管理-工作
export function workingOrder() {
  return request({
    url: '/admin/status/work/',
    method: 'put'
  })
}

//工单管理-休息
export function stopOrder() {
  return request({
    url: '/admin/status/rest/',
    method: 'put'
  })
}

//通过ID查询工单详细信息
export function getWorkOrderById(id) {
  return request({
    url: `/api/work_order/${id}/`,
    method: 'get'
  })
}

// 质检提交
export function updateWordQuality(id,data) {
  return request({
    url:`/api/work_order/quality/${id}/`,
    method:'put',
    data
  })
}

//获取所有转接信息
export function getOnlineUser(params) {
  return request({
    url: '/api/work_order/get_online_user/',
    method: 'get',
    params
  })
}

//获取转接记录列表
export function getReassignList(params) {
  return request({
    url: '/api/reassign/',
    method: 'get',
    params
  })
}

//绩效管理
export function getPerformanceList(params) {
  return request({
    url: '/api/performance/',
    method: 'get',
    params
  })
}

export function getPhrase(params) {
  return request({
    url: '/api/customer/phrase/',
    method: 'get',
    params
  })
}

export function getReportDownLoad(params) {
  return request({
    url: '/api/report/download/',
    method: 'get',
    params
  })
}

export function getPerformanceDownLoad(params) {
  return request({
    url: '/api/performance/download/',
    method: 'get',
    params
  })
}


export function getReportTTlList(params) {
  return request({
    url: '/api/report/ttl/',
    method: 'get',
    params
  })
}
export function getReportList(params) {
  return request({
    url: '/api/report/',
    method: 'get',
    params
  })
}

//绩效管理汇总
export function getPerformanceTTlList(params) {
  return request({
    url: '/api/performance/ttl/',
    method: 'get',
    params
  })
}


//七牛文件上传
export function qiniuUpload(data) {
  return request({
    url: `http://up-z2.qiniup.com/`,
    method: 'post',
    data
  })
}

//获取上传Token
export function getQiniuUploadToken() {
  return request({
    url: '/api/get_upload_token/',
    method: 'get',
  })
}

//通过图片名称获取图片
export function getPritureByKey(params) {
  return request({
    url: 'api/get_file_path/',
    method: 'get',
    params
  })

}


//修改个人密码
export function resetMyPassword(data) {
  return request({
    url: '/admin/reset_password/',
    method: 'put',
    data
  })
}

//重置密码
export function resetPassword(id) {
  return request({
    url: `/admin/reset_password/${id}/`,
    method: 'put'
  })
}


export function getUserList(params) {
  return request({
    url: '/admin/users/',
    method: 'get',
    params
  })
}

export function getKefuAdminList(params) {
  return request({
    url: '/api/get_kefu_admin/',
    method: 'get',
    params
  })
}

export function getKefuList(params) {
  return request({
    url: '/api/get_kefu/',
    method: 'get',
    params
  })
}

export function getBlackList(params) {
  return request({
    url: '/api/agency/blacklist/',
    method: 'get',
    params
  })
}

export function deleteUser(id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'delete'
  })
}

export function getUserDetail(id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'get'
  })
}

export function editUserDetail(data, id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'put',
    data
  })
}

export function saveAddUser(data) {
  return request({
    url: `/admin/users/`,
    method: 'post',
    data
  })
}

export function getRoleList(params) {
  return request({
    url: '/admin/roles/',
    method: 'get',
    params
  })
}

export function getRoleDetail(id) {
  return request({
    url: `/admin/roles/${id}/`,
    method: 'get'
  })
}

export function getPermissions() {
  return request({
    url: `/admin/permissions/`,
    method: 'get'
  })
}

export function editRoleDetail(data, id) {
  return request({
    url: `/admin/roles/${id}/`,
    method: 'put',
    data
  })
}

export function saveAddRole(data) {
  return request({
    url: `/admin/roles/`,
    method: 'post',
    data
  })
}


//转接工单
export function reassignWordOrder(id,data) {
  return request({
    url:`/api/work_order/reassign/${id}/`,
    method:'put',
    data
  })
}

// 登录申诉
export function getLoginHelpList(params) {
  return request({
    url: '/api/login_order/',
    method: 'get',
    params
  })
}

//通过id获取登录申诉详情
export function getLoginHelpById(id) {
  return request({
    url:`/api/login_order/${id}/`,
    method:'get'
  })
}

export function updateLoginHelpById(id,data) {
  return request({
    url:`/api/login_order/${id}/`,
    method:'put',
    data
  })
}

// 工单下载
export function uploadWordOrder(params) {
  return request({
    url:`api/work_order/download/`,
    method:'get',
    params,
  })
}

// 工单管理 质检人列表
export function getQualityUser() {
  return request({
    url:`api/get_kefu_admin/`,
    method:'get'
  })
}

// 客服回单 已处理/待处理
export function getCustomerOrderCount() {
  return request({
    url:`api/customer_order_count/`,
    method:'get'
  })
}

// 登录申诉 导出
export function uploadLoginHelpData(params) {
  return request({
    url: `api/login_order/download/`,
    method: 'get',
    params,
  })
}

//获取 分时数据列表
export function getSegmentList(params) {
  return request({
    url: '/api/segment_report/',
    method: 'get',
    params
  })
}

// 分时数据列表 导出
export function uploadSegmentData(params) {
  return request({
    url: `/api/segment_report/download/`,
    method: 'get',
    params,
  })
}
